package com.gbx.ximalayating.fragment;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.gbx.ximalayating.R;
import com.squareup.picasso.Picasso;

/**
 * A simple {@link Fragment} subclass.
 */
public class FocusImagesFragment extends Fragment {


    public FocusImagesFragment() {
        // Required empty public constructor
    }

    public static FocusImagesFragment getInstance(String imageURL) {
        FocusImagesFragment fragment = new FocusImagesFragment();
        Bundle bundle = new Bundle();
        bundle.putString("imageURL", imageURL);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_focus_images, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        String imageURL = getArguments().getString("imageURL");
        ImageView imageView = (ImageView) view.findViewById(R.id.focus_image);
        Picasso.with(getContext()).load(imageURL).into(imageView);
    }
}
